
<?
$order = get_segment(3);
?>
<h1 class="ttt"><span>شحنات بإنتظار الإرسال</span></h1>

<div id="inner">
    <div class="submit" id="ui-state-persist">
        <a href="<?php echo base_url() ?><?php echo get_segment(1) ?>/forshiping/up/<?php echo get_segment(4) ?>"  <? if ($order == 'up' || empty($order)) { ?>class="ui-btn-active " <? } ?> ><?php echo lang('label_sort_order_desc') ?></a>
        <a href="<?php echo base_url() ?><?php echo get_segment(1) ?>/forshiping/dw/<?php echo get_segment(4) ?>"  <? if ($order == 'dw') { ?> class="ui-btn-active" <? } ?> ><?php echo lang('label_sort_order_asc') ?></a>
    </div>

    <table class="tables">
        <thead>
            <tr class="head-row">
                <th>الرقم</th>
                <th><?php echo lang('label_created_date') ?></th>
                <th><?= lang('label_title') ?></th>
                <th><?= lang('label_weight') ?></th>
                <th><?= lang('label_quantity') ?></th>
                <th><?= lang('label_price') ?></th>
                <th></th>
            </tr>
        </thead>
        <tbody>   
            <?
            foreach ($result as $val) {
                if ($val->type == 'item_box') {
                    $items = get_items_under_box($val->id);
                } else {
                    $items = array();
                }
                ?>
                <tr class="row <?
            if (count($items) > 0) {
                echo 'maximize';
            }
                ?>">
                    <td><a href="<?= base_url() ?>orders/view/<?php echo $val->id ?>"><?php echo $val->id ?></a></td>
                    <td><?php echo $val->create_date ?></td>
                    <td><? if (!empty($val->title)) { ?><a href="<?= $val->link ?>" target="_blank"><?php echo substr($val->title, 0, 50) ?>..</a> <?
                } else {
                    echo $val->store;
                }
                ?></td>
                    <td><?= $val->weight ?> <?= lang('label_lbs') ?></td>
                    <td><?= $val->quantity ?></td>
                    <td><?= $val->price ?> <?= lang('label_rial') ?></td>
                    <td>
                        <?
                        if ($val->statue_id == 10) {
                            ?>
                            <a class="cancel" href="<?= base_url() . get_segment(1) ?>/delforshiping/<?= $val->id ?>">الغاء</a>
                            <?
                        }else{
                            $statues=get_statues($val->statue_id,1);
                            echo $statues->title;
                        }
                        ?>
                    </td>
                </tr>
                <?
                if (count($items) > 0) {
                    ?>
                    <tr>
                        <td class="detail" colspan="7">
                            <div class="detail_" >
                                <table>
                                    <tbody>
                                        <tr class="row-detail-head">
                                            <th><?= lang('label_title') ?></th>
                                            <th><?= lang('label_quantity') ?></th>
                                            <th><?= lang('label_battery') ?></th>

                                            <th><?= lang('label_perfum') ?></th>
                                        </tr>
                                        <? foreach ($items as $value) { ?>           
                                            <tr class="row-detail">
                                                <td style="width: 60%;">
                                                    <a href="<?=$value->link?>"><?=$value->title?></a>
                                            </td>
                                                <td><?= $value->quantity ?></td>
                                                <td><?= lang('label_' . strtolower($value->battery)) ?></td>
                                                <td><?= lang('label_' . strtolower($value->perfum)) ?></td>
                                            </tr> 
                                        <? } ?>
                                    </tbody>
                                </table>  
                            </div>
                        </td>
                    </tr>
                    <?
                }
                ?>
            <? } ?>

        </tbody>
    </table>

    <br><br><br>
</div>

<?php
echo $pagination?>